use crate::message::Message;

pub trait MessageReceiver {
    fn recv(&self) -> Option<Box<dyn Message>>;
}

// 定义上下文
pub struct Context<M> {
    pub receiver: M,
}

impl<M: MessageReceiver> Context<M> {
    pub fn new(receiver: M) -> Self {
        Context { receiver }
    }
}